package com.yuncheng.spcyApi.busService.exam.controller;

import com.yuncheng.spcyApi.alog.annotation.Log;
import com.yuncheng.spcyApi.busService.exam.service.ParseQuestionTextService;
import com.yuncheng.spcyApi.service.ISpcyRsYwzdxxService;
import com.yuncheng.spcyApi.vo.common.HttpResultVo;
import com.yuncheng.vo.HttpResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author hua
 */
@Api(tags = "审评查验-培训试卷模板题目读取接口")
@RestController
@RequestMapping("/api/spzx-spcy/exam")
public class ExamController {

    @Resource
    private ParseQuestionTextService parseQuestionTextService;

    @Resource
    private ISpcyRsYwzdxxService spcyRsYwzdxxService;

    @Log(title = "根据试卷文档生成题目-根据试卷id")
    @ApiOperation(value = "根据试卷文档生成题目-根据试卷id")
    @PostMapping(value = "uploadStWord")
    public HttpResult uploadStWord(@RequestPart("file") MultipartFile uploadFile,
                                   @RequestParam(value = "id",defaultValue = "") @ApiParam("试卷id") String sjid){

        return parseQuestionTextService.analyzeSjWord(uploadFile, sjid);
    }

    @ApiOperation(value = "根据试卷文档生成题目-根据试卷id")
    @GetMapping(value = "querySjImportTemplate")
    public HttpResult querySjImportTemplate(){

        return HttpResultVo.HttpResultGet(spcyRsYwzdxxService.selectPxSjImportTemplate());
    }
}
